package com.kstech.mp3604.fragments


import com.blankii.androidlibrary.exts.loge
import com.blankj.utilcode.util.SPUtils
import com.kstech.mp3604.base.BaseDialogFragment
import com.kstech.mp3604.base.Global.WARE_HOUSE_ID
import com.kstech.mp3604.base.Global.app_wareHouse
import com.kstech.mp3604.databinding.FragmentDialogSetWareHouseBinding

/**
 * 对话框绑定仓库id
 */
class DialogSetWareHouseFragment :
    BaseDialogFragment<FragmentDialogSetWareHouseBinding>(FragmentDialogSetWareHouseBinding::inflate) {
    override fun onInitView() {

        binding.apply {
//            val whId = SPUtils.getInstance().getString(WARE_HOUSE_ID)
            setWareHouseView.setText(app_wareHouse)

            closeDialog.setOnClickListener {
                dialog!!.cancel()

            }

            submit.setOnClickListener {
                val value = setWareHouseView.text.toString().trim()
                value.loge("blankii-DialogSetWareHouseFragment:输入的初始仓库号id")
                app_wareHouse = value
                SPUtils.getInstance().put(WARE_HOUSE_ID, value)
                dialog!!.cancel()
            }
        }
    }
}